#ifndef GLCANVAS_H
#define GLCANVAS_H

#include <map>

#include <wx/glcanvas.h>

#include <Klein/Shader/FragmentIdentifier.h>
#include <Klein/Shader/Graph.h>

class GLCanvas : public wxGLCanvas
{
public:

	GLCanvas(wxWindow* parent, wxWindowID id, int* args);
	virtual ~GLCanvas();

public:

	void OnMotion(wxMouseEvent& event);
	void OnLeftDown( wxMouseEvent& event);
	void OnRightDown(wxMouseEvent& event);

	void OnPaint(wxPaintEvent& event);
	void OnResize(wxSizeEvent& event);

	void OnFragmentMenuClick(wxCommandEvent& event);

	DECLARE_EVENT_TABLE()

private:

	void Render(const bool selectionMode);

private:

	wxGLContext* mContext;

	std::map<int, FragmentIdentifier> mFragmentMenuItemNumbersToFragmentIdentifiers;
	std::auto_ptr<wxMenu> mFragmentMenu;

	wxPoint mLeftDownPosition;
	wxPoint mRightDownPosition;
};

#endif
